package com.maywide.jdp.system.spring;

import java.util.Locale;

import org.springframework.core.Ordered;
import org.springframework.web.context.support.WebApplicationObjectSupport;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.ViewResolver;

public class ErrorViewResolver extends WebApplicationObjectSupport implements ViewResolver,Ordered {
	private int order = Integer.MAX_VALUE;

	@Override
	public int getOrder() {
		return this.order ;
	}

	public void setOrder(int order) {
		this.order = order;
	}

	@Override
	public View resolveViewName(String viewName, Locale locale)
			throws Exception {
		if(ErrorView.VIEW_NAME.equals(viewName))
			return getApplicationContext().getBean(viewName,View.class);
		else
			return null;
	}
}
